package com.tangcl.module_mine.network

import com.tangcl.module_commom.network.BaseNetResponse
import com.tangcl.module_mine.bean.UserInfo
import retrofit2.Call
import retrofit2.http.Field
import retrofit2.http.FieldMap
import retrofit2.http.FormUrlEncoded
import retrofit2.http.POST

/**
 * Created by TCL on 2021/10/9
 *
 * description:
 */
interface MineApiService {

    //eg:post
    @FormUrlEncoded
    @POST("user/login")
    suspend fun testPostLogin(
        @Field("username") username: String,
        @Field("password") password: String
    ): BaseNetResponse<UserInfo>

    //eg:非协程Call
    @FormUrlEncoded
    @POST("/user/login")
//    fun doLogin(@FieldMap params: Map<String, String>): String
    fun doLogin(@FieldMap params: Map<String, String>): Call<BaseNetResponse<UserInfo>>

    //普通协程
    @FormUrlEncoded
    @POST("/user/login")
    suspend fun doLoginResponse(@FieldMap params: Map<String, String>): BaseNetResponse<UserInfo>

    //协程+封装
    @FormUrlEncoded
    @POST("/user/login")
    suspend fun doLoginRepo(@FieldMap params: Map<String, String>): BaseNetResponse<MineLoginRepo>
}